Migrate data into MongoDB deployment

If you would like to migrate your data into MongoDB deployment, the following steps will help you clear the obstacles in the migration process.

1.Export data from source instance

Connect the source instance from an authorized account and export data from the source instance by executing the command![]

mongodump -h <domain name> -d <database> -u <dbuser> -p <dbpassword> --authenticationDatabase "admin" --archive=<Desired File Path>

Take the following command as an example to export your database and generate a backup file named mongodump-20180523.archive.

mongodump -h 172.107.32.103:27017 -d testdb -u root -p passwd --authenticationDatabase admin  --archive=/data/mongodump-20180523.archive

2. Import data into MongoDB deployment

Execute command

mongorestore -h <domain name> -d <database> -u <dbuser> -p <dbpassword> --authenticationDatabase "admin" --archive=<backup file path>

to import all data in the above backup file into MongoDB deployment. Take the following command as an example to import your data

mongorestore -h 172.107.32.103:27017 -d db1 -u root -p passwd --authenticationDatabase admin --archive=/data/mongodump-20180523.archive
Copyright © 2021 Cloud Clusters Inc.Revised on 12/24/2020

results matching ""

    No results matching ""